﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using DAO;


namespace BUS
{
    public class GianHangBUS
    {
        public static List<GianHangDTO> LayDanhSachGianHang()
        {
            return GianHangDAO.LayDanhSachGianHang();
        }

        public static int LayMaGianHangTheoChuGianHang(int chugianhang)
        {
            int magianhang = 0;
            try
            {
                magianhang = GianHangBUS.LayMaGianHangTheoChuGianHang(chugianhang);
            }
            catch (Exception)
            {
                return 0;
            }
            return magianhang;
        }

        public static List<GianHangDTO> LayDanhSachGianHangTheoTinhTrang(bool tinhtrang)
        {
            return GianHangDAO.LayDanhSachGianHangTheoTinhTrang(tinhtrang);
        }

        public static GianHangDTO LayGianHangTheoID(int id)
        {
            return GianHangDAO.LayGianHangTheoID(id);
        }

        public static bool XoaGianHangTheoMaChuGianHang(int chugianhang)
        {
            return GianHangBUS.XoaGianHangTheoMaChuGianHang(chugianhang);
        }
        
        public static int LayIDGianHangCuoiCung()
        {
            return GianHangDAO.LayIDGianHangCuoiCung();
        }

        public static bool ThemGianHang(GianHangDTO gianhang)
        {
            return GianHangDAO.ThemGianHang(gianhang);
        }

        public static bool CapNhatGianHang(GianHangDTO gianhangDTO)
        {
            return GianHangDAO.CapNhatGianHang(gianhangDTO);
        }

        public static bool XoaGianHangTheoID(int id)
        {
            return GianHangDAO.XoaGianHangTheoID(id);
        }
    }
}
